<?php
/*
	提现
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
global $_RQ;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$this->model('model')->check_worker();
if($_RQ['op']=='get'){
	$data=array();
	$data['fee']=pdo_getsum('jy_mjicai_canlog',array('uniacid'=>$_SESSION['uniacid']),'jifen');
	$data['num']=pdo_count('jy_mjicai_canlog',array('uniacid'=>$_SESSION['uniacid']));
	$return['data']=$data;
	$return['params']=array('type'=>0);
	set_html('title','参与记录');
	exi($return);
}
// js 获取数据
if($_RQ['op']=='getlist'){
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_mjicai_canlog',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$v){
			$v['member']=cfc('core')->member_show($v['mid']);
			$cang=pdo_get('jy_mjicai_cang',array('id'=>$v['cangid'],'uniacid'=>$_SESSION['uniacid']));
			$teampaixu=$cang['paixu'];
			$v['jian_getrate']=$cang['jian_getrate'];
			$yaopaixu=pdo_getcolumn('jy_mjicai_yao',array('id'=>$v['cangid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$status=pdo_getcolumn('jy_mjicai_yao',array('id'=>$v['yaoid'],'uniacid'=>$_SESSION['uniacid']),'status');
			$v['createtime']=date('Y-m-d H:m:s',$v['createtime']);
			$v['statustitle']=$this->yao_status[$status];
			$v['title']='第'.$teampaixu.'仓第'.$yaopaixu.'期';	
		}
	}	
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='getlist1'){
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_mjicai_jilog',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['createtime']=date('Y-m-d H:m:s',$item['createtime']);
			$item['paixu']=pdo_getcolumn('jy_mjicai_yao',array('id'=>$item['yaoid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$item['status']=pdo_getcolumn('jy_mjicai_yao',array('id'=>$item['yaoid'],'uniacid'=>$_SESSION['uniacid']),'status');
			$item['paixu']=$item['cangid'].'仓第【'.$item['paixu'].'】期';
			$item['statustitle']='已释放';
		}
	}	
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='getlist2'){
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$commission_money_types=plugin('jy_mjicai')->commission_money_types;
	$list=pdo_getslice('jy_mjicai_commission',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['createtime']=date('Y-m-d H:m:s',$item['createtime']);
			$item['level']=$item['type']?:$item['level'];
			if($item['is_sale']){
				$item['level']='sale'.$item['level'];
			}
			$num=pdo_count('jy_mjicai_cang',array('id <='=>$item['cangid'],'uniacid'=>$_SESSION['uniacid']));
			$item['cangtitle']='第【'.$num.'】仓';
			$paixu=pdo_getcolumn('jy_mjicai_yao',array('id'=>$item['yaoid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$item['yaotitle']='第【'.$paixu.'】期';
			$item['statustitle']=$commission_money_types[$item['type']];
		}
	}	
	$return['list']=$list;
	exi($return);
}
if($_RQ['op']=='getlist3'){
	$params=array();
	$params['uniacid']=$_SESSION['uniacid'];
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_mjicai_feelog',$params,array($pindex,$psize),$total,$fields,'','id desc');
	$canlog_status=plugin('jy_mjicai')->canlog_status;
	$feelog_type=plugin('jy_mjicai')->feelog_type;
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['createtime']=date('Y-m-d H:m:s',$item['createtime']);
			$teampaixu=pdo_getcolumn('jy_mjicai_cang',array('id'=>$item['cangid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$yaopaixu=pdo_getcolumn('jy_mjicai_yao',array('id'=>$item['cangid'],'uniacid'=>$_SESSION['uniacid']),'paixu');
			$item['createtime']=date('Y-m-d H:m:s',$item['createtime']);
			$item['statustitle']=$feelog_type[$item['type']];
			$item['title']='第'.$teampaixu.'仓第'.$yaopaixu.'期';
		}
	}	
	$return['list']=$list;
	exi($return);
}